package com.example.demoview;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class myhello {

    @RequestMapping("/hello")
    //@ResponseBody  没有这个是显示hello.html的内容，有就显示hello字符.
    public String hello(){
        //return "Hello World， Spring boot is good hello";
        return "hello";
    }

    @RequestMapping("/myhello")
    @ResponseBody
    public ModelAndView test(){
        ModelAndView  model = new ModelAndView();
        model.setViewName("/test");//界面路径
        return  model;
    }

}
